/ Assembly List / LJCNetCommon / XMLBuilder / AddIndent

Namespace - LJCNetCommon


Parameters
increment - The amount to increment or decrement the indent count.

Returns

The current indent count.

Syntax

C#
public Int32 AddIndent(Int32 increment = 1)

Changes the IndentCount by the provided value.

Example

C#
// Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
var xb = new XMLBuilder();

// Example Method:
// The builder keeps track of the current number of indents.
// Adds 1 indent by default.
xb.AddIndent();

// Adds text without modification.
xb.AddText("This text is not indented.");

// Starts the text with a newline if the builder already has text
// and param allowNewLine = true and builder text does not end with
// a newline.
// The text begins with the current indent string if param
// addIndent = true.
// Defaults: addIndent = true, allowNewLine = true.
xb.Text("This text is indented.");

// No Indent
var addIndent = false;
xb.Text("Not indented.", addIndent);

// Do not start a newline.
xb.Text("No start with newline.", allowNewLine: false);
var result = xb.ToString();

// result:
// This text is not indented.
//   This text is indented.
// Not indented.  No start with newLine.

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.